package com.jhl.seckill.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 解析IP
 */
@Component
public class IpLimiter implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
//        System.out.println(httpServletRequest.getRemoteAddr());
        return httpServletRequest.getRemoteAddr();
    }
}
